package com.ssy.lingxi.report.controller;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.report.model.vo.request.MemberManualSettlementVO;
import com.ssy.lingxi.report.model.vo.request.PlatformManualSettlementVO;
import com.ssy.lingxi.report.model.vo.request.ScoreManualSettlementVO;
import com.ssy.lingxi.report.service.IMemberSettlementService;
import com.ssy.lingxi.report.service.IPlatformSettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @menu 结算报表
 * @author 伍将
 * @date 2020/12/24
 * @version 2.0.0
 */
@RestController
@RequestMapping("/report/settlement")
public class SettlementController extends BaseController {

    @Autowired
    private IMemberSettlementService memberSettlementService;

    @Autowired
    private IPlatformSettlementService platformSettlementService;

    /**
     * 结算能力-应付账款管理-手动结算
     * @author 伍将
     * @date 2020/12/24
     **/
    @RequestMapping("/memberManualSettlement")
    Wrapper<Void> memberManualSettlement(HttpServletRequest httpRequest, @RequestBody @Valid MemberManualSettlementVO settlementVO) {
        getSysUser(httpRequest);
        return memberSettlementService.manualSettlement(settlementVO);
    }

    /**
     * 平台结算管理-代收账款结算--手动结算
     * @author 伍将
     * @date 2020/12/24
     **/
    @RequestMapping("/platformManualSettlement")
    Wrapper<Void> platformManualSettlement(HttpServletRequest httpRequest, @RequestBody @Valid PlatformManualSettlementVO settlementVO) {
        return platformSettlementService.platformManualSettlement(getSysUser(httpRequest), settlementVO);
    }

    /**
     * 平台结算管理-积分结算--手动结算
     * @author 伍将
     * @date 2020/12/24
     **/
    @RequestMapping("/scoreManualSettlement")
    Wrapper<Void> scoreManualSettlement(HttpServletRequest httpRequest, @RequestBody @Valid ScoreManualSettlementVO settlementVO) {
        return platformSettlementService.scoreManualSettlement(getSysUser(httpRequest), settlementVO);
    }
}
